IPython 8.4.0 Pypi GitHub Homepage
Other Docs
magic_deco(arg)

The decorator can be used with or without arguments, as follows.

@deco
def foo(...)

will create a line magic named :None:None:`foo`.

  1. with one string argument: which will be used as the actual name of the

resulting magic:

@deco('bar')
def foo(...)

will create a line magic named :None:None:`bar`.

To register a class magic use Interactiveshell.register_magic(class or instance) .

Note: this decorator can only be used in a context where IPython is already active, so that the :None:None:`get_ipython()` call succeeds. You can therefore use it in your startup files loaded after IPython initializes, but not in the IPython configuration file itself, which is executed before IPython is fully up and running. Any file located in the startup subdirectory of your configuration profile will be OK in this sense.

Decorate the given function as line magic.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/core/magic.py#213
type: <class 'function'>
Commit: